
package lesson3.com.xml.transform;

import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import lesson3.slides.xml.dom.DomParserExample;

import org.w3c.dom.Document;

public class TransformExample {

    public static void main(String[] args) throws Exception {
        TransformerFactory transformerFactory =
                TransformerFactory.newInstance();

        Transformer transformer =
                transformerFactory.newTransformer();
        
        // use DomParserExcample to get Document
        DomParserExample.main(null);
        
        Document d = DomParserExample.d;

        // d is our Document
        DOMSource source = new DOMSource(d);

        // Send XML representation to the console
        StreamResult result = new StreamResult(System.out);
        transformer.transform(source, result);
        System.out.println();
    }
}
